home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fritz: All Fritz
/
All Fritz.zip
/
All Fritz
/
FILES
/
PROGNG_C
/
TURBOCU2.LZH
/
INDEX.ARC
/
IREADR.C
< prev
next >
Wrap
Text File
|
1987-08-21
|
1KB
|
38 lines
/*
* IREADR.C - Random read
*
* Copyright (c) 1987, Jim Mischel
* Modifications:
*
* 08/13/87 - jim - original coding
*/
#include "inxdefs.h"
/*
* iread() - return the record referenced by the key value in destination
* record. If successful, returns 0 with data record in destin.
* If unsuccessful, returns error status and the data at destin is unchanged.
*
* This routine assumes there is enough space at 'dest' to store the entire
* data record.
*/
int iread(void *d, void *dest)
{
register df_rec *db_control = (df_rec *)d;
char *destin = (char *)dest;
/* find the record */
if (isearch(db_control,(destin+db_control->df_key_offset)) == 0) {
/* record found, copy into user's buffer */
memcpy(destin,db_control->df_dat_buff,db_control->df_rec_size);
db_control->df_flags &= ~DF_DELETE;
return(0);
}
else {
if (ierrno == 0)
ierror(I_NOREC);
return(I_NOREC);
}
} /* iread */